¡@

Home 

c++ Programming Glossary: b^

Potential Problem in “Swapping values of two variables without using a third variable”

http://stackoverflow.com/questions/3741440/potential-problem-in-swapping-values-of-two-variables-without-using-a-third-var

values of two variables without using a third variable. a^ b^ a^ b But when I tried the above code on different compilers.. question Is anything terribly wrong with the code Yes a^ b^ a^ b in fact invokes Undefined Behaviour in C and in C because.. although not foolproof a ^ b b ^ a a ^ b instead of a^ b^ a^ b . P.S Never try to swap the values of two variables without..

Sequence Point - Xor Swap on Array get wrong result

http://stackoverflow.com/questions/9958514/sequence-point-xor-swap-on-array-get-wrong-result

Xor operator to swap two integers like int a 21 int b 7 a^ b^ a^ b I would finally get a 7 and b 21. I try to use xor operator.. different on compiler between a 0 ^ a 1 ^ a 0 ^ a 1 and a^ b^ a^ b My doubt is How does compiler output 0 7 for a 0 ^ a 1.. on a 0 ^ a 1 ^ a 0 ^ a 1 it looks just the same as a^ b^ a^ b . So I'd like to know how it works with array. So that..